package com.tao.learning.api;

import com.tao.base.model.Result;
import com.tao.base.utils.SecurityUtil;
import com.tao.learning.service.LearningService;
import com.tao.learning.service.impl.LearningServiceimpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.M
 * @version 1.0
 * @description 我的学习接口
 * @date 2022/10/27 8:59
 */
@Tag(name = "学习过程管理接口", description = "学习过程管理接口")
@Slf4j
@RestController
public class MyLearningController {

    @Autowired
    LearningServiceimpl learningService;

    @Operation(summary = "获取视频")
    @GetMapping("/open/learn/getvideo/{courseId}/{teachplanId}/{mediaId}")
    public Result<String> getvideo(@PathVariable("courseId") Long courseId, @PathVariable("teachplanId") Long teachplanId, @PathVariable("mediaId") String mediaId) {

        SecurityUtil.User user = SecurityUtil.getUser();
        String userId = user.getId();
        return Result.success(learningService.getCourseVideo(userId, courseId, teachplanId, mediaId));

    }

}
